﻿<!DOCTYPE html>
<html>
<head>
    <title>编辑文章-微街秀</title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta name="viewport" content="width=device-width,height=device-height,inital-scale=1.0,maximum-scale=1.0,user-scalable=no;">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="format-detection" content="telephone=no">
    <link href="Client/plugins/bootstrap/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
    <link href="Client/css/base.css" rel="stylesheet" type="text/css" />
</head>
<body>
    <div class="container-fluid mt10">   
          <button id="wx_setting" class="btn btn-primary btn-block" onclick="document.location.href='weixin://dl/moments/'">
            微信设置</button>
        <button id="alipay" class="btn btn-primary btn-block">
            支付宝</button>
        <button id="wxpay" class="btn btn-primary btn-block">
            微信支付</button>
        <hr />
        <button id="shared" class="btn btn-primary btn-block">
            默认分享</button>
        <button id="sharedList" class="btn btn-primary btn-block">
            选择性分享</button>
        <hr />
        <button id="cutImage" class="btn btn-primary btn-block">
            裁剪图片</button>
        <button id="compressImage" class="btn btn-primary btn-block">
            压缩图片</button>
        <button id="resource" class="btn btn-primary btn-block">
            原图</button>
        <button id="cameraCut" class="btn btn-primary btn-block">
            拍照裁剪</button>
        <button id="cameraCompress" class="btn btn-primary btn-block">
            拍照压缩</button>
        <button id="cameraResource" class="btn btn-primary btn-block">
            拍照原图</button>
        <button id="user" class="btn btn-primary btn-block">
            用户选择</button>
        <hr />
        <button id="pushInfo" class="btn btn-primary btn-block">
            推送信息</button>
        <hr />
        <button id="location" class="btn btn-primary btn-block">
            获取位置</button>
        <hr />
        <button id="wxOauth" class="btn btn-primary btn-block">
            微信授权</button>
        <button id="qqOauth" class="btn btn-primary btn-block">
            qq授权</button>
        <hr />
        <button id="copy" class="btn btn-primary btn-block">
            复制</button>
        <button id="copy2" class="btn btn-primary btn-block">
            复制(回调)</button>
        <hr />
        <button id="openWxApp" class="btn btn-primary btn-block">
            打开微信app</button>
        <hr />
        <button id="openURL" class="btn btn-primary btn-block">
            打开新窗口</button>
        <hr />
    </div>
    <script src="Client/js/jquery-2.1.4.min.js" type="text/javascript"></script>
    <script>
        $(function () {

            $("#alipay").on("click", function () {

                var tradeNo = parseInt(Math.random() * 1000000000) + "";
                var param = { subject: "标题", body: "商品简介", price: 0.01, out_trade_no: tradeNo, notify_url: "http://wjxtest.711688.com/Alipay2/notify_url.aspx", callback: "alipayCallback" };

                var p = JSON.stringify(param);
                alert(p);
                window.location.href = "callback://alipay?" + p;
            });

            $("#shared").on("click", function () {
                var p = { url: "http://wjx.711688.net/client/item.aspx?article_id=3784&advert_id=558&shareid=19330", title: "一富婆坐飞机，她只坐头等舱！她无意中透露的秘密…", logo: "http://wjx.711688.com/Upload/Image/2016/01/_0_20160111180524f7056k.jpg", description: "茶叶的小故事张三一直喜欢喝20块钱的茶叶", callback: "sharedCallback" };
                p = JSON.stringify(p);
                alert(p);
                window.location.href = "callback://shared?" + encodeURIComponent(p);
            });

            $("#sharedList").on("click", function () {
                var p = { url: "http://wjx.711688.net/client/item.aspx?article_id=3784&advert_id=558&shareid=19330", title: "一富婆坐飞机，她只坐头等舱！她无意中透露的秘密…", logo: "http://wjx.711688.com/Upload/Image/2016/01/_0_20160111180524f7056k.jpg", description: "茶叶的小故事张三一直喜欢喝20块钱的茶叶", callback: "sharedCallback", shareList: ["weixin_circle"] };
                p = JSON.stringify(p);
                alert(p);
                window.location.href = "callback://shared?" + encodeURIComponent(p);
            });

            //裁剪图片
            $("#cutImage").on("click", function () {

                var param = { type: 1, cutType: 1, width: 300, height: 600, callback: "ok", url: "http://192.168.1.155/Client/Ajax/Upload.ashx?Img" };

                var p = JSON.stringify(param);
                alert(p);

                window.location.href = "callback://imageUpload?" + p;
            });


            //压缩图片
            $("#compressImage").on("click", function () {

                var param = { type: 1, cutType: 2, width: 640, callback: "ok", url: "http://192.168.1.155/Client/Ajax/Upload.ashx?Img" };

                var p = JSON.stringify(param);
                alert(p);

                window.location.href = "callback://imageUpload?" + p;
            });


            //不处理
            $("#resource").on("click", function () {

                var param = { type: 1, cutType: 3, callback: "ok", url: "http://192.168.1.155/Client/Ajax/Upload.ashx?Img" };

                var p = JSON.stringify(param);
                alert(p);

                window.location.href = "callback://imageUpload?" + p;
            });


            //拍照裁剪
            $("#cameraCut").on("click", function () {

                var param = { type: 2, cutType: 1, width: 500, height: 300, callback: "ok", url: "http://192.168.1.155/Client/Ajax/Upload.ashx?Img" };

                var p = JSON.stringify(param);
                alert(p);

                window.location.href = "callback://imageUpload?" + p;
            });


            //拍照压缩
            $("#cameraCompress").on("click", function () {

                var param = { type: 2, cutType: 2, width: 640, callback: "ok", url: "http://192.168.1.155/Client/Ajax/Upload.ashx?Img" };

                var p = JSON.stringify(param);
                alert(p);

                window.location.href = "callback://imageUpload?" + p;
            });

            //拍照压缩
            $("#cameraResource").on("click", function () {

                var param = { type: 2, cutType: 3, callback: "ok", url: "http://192.168.1.155/Client/Ajax/Upload.ashx?Img" };

                var p = JSON.stringify(param);
                alert(p);

                window.location.href = "callback://imageUpload?" + p;
            });

            //用户选择照片来源
            $("#user").on("click", function () {

                var param = { cutType: 1, width: 300, height: 360, callback: "ok", url: "http://192.168.1.155/Client/Ajax/Upload.ashx?Img" };

                var p = JSON.stringify(param);
                alert(p);

                window.location.href = "callback://imageUpload?" + p;
            });

            //获取推送信息
            $("#pushInfo").on("click", function () {

                var param = { callback: "pushCallBack" };

                var p = JSON.stringify(param);
                alert(p);

                window.location.href = "callback://pushInfo?" + p;
            });

            //获取获取位置
            $("#location").on("click", function () {

                /*
                isRefresh:可选参数  默认false,是否要刷新位置再回调
                callback:获取到位置后回调函数,回调函数有一个JSON字符串格式的的参数 里面包含了位置信息,如:{"address":"中国广东省深圳市福田区东园路196号","city":"深圳市","cityCode":"340","country":"中国","countryCode":"0","district":"福田区","province":"广东省","street":"东园路","streetNumber":"196号","latitude":22.53795,"longitude":114.095114}
                */
                var param = { callback: "locCallBack", isRefresh: false };

                var p = JSON.stringify(param);
                alert(p);

                window.location.href = "callback://location?" + p;
            });

            //微信授权
            $("#wxOauth").on("click", function () {
                var param = { callback: "oauthCallBack", platform: "weixin" };

                var p = JSON.stringify(param);
                alert(p);

                window.location.href = "callback://doOauth?" + p;
            });

            //qq授权
            $("#qqOauth").on("click", function () {
                var param = { callback: "oauthCallBack", platform: "qq" };

                var p = JSON.stringify(param);
                alert(p);

                window.location.href = "callback://doOauth?" + p;
            });

            //微信支付
            $("#wxpay").on("click", function () {

                var outTradeNo = "asdasdsdl" + Math.floor(Math.random() * 1000000);
                var param = { subject: "阿斯顿回家", body: "胜多负少", notifyUrl: "http://192.168.1.155", outTradeNo: outTradeNo, money: 1, callback: "wxPayCallBack" };

                var p = JSON.stringify(param);
                alert(p);

                window.location.href = "callback://weixinPay?" + p;
            });


            //复制
            $("#copy").on("click", function () {
                var param = "这里是要复制的内容";
                alert(param);
                window.location.href = "callback://copy?" + encodeURIComponent(param);
            });


            //复制(回调)
            $("#copy2").on("click", function () {
                var param = { content: "这里是复制的内容", callback: "copyCallBack" };

                var p = JSON.stringify(param);
                alert(p);

                window.location.href = "callback://copy?" + p;
            });

            //打开微信
            $("#openWxApp").on("click", function () {
                var param = { name: "weixin", callback: "openAppCallBack" };

                var p = JSON.stringify(param);
                alert(p);

                window.location.href = "callback://openApp?" + p;
            });

            //打开新窗口
            $("#openURL").on("click", function () {
                var param = { url: "http://www.baidu.com", title: "这里是标题", hasTop: true, hasCopy: true, hasShare: true };

                var p = JSON.stringify(param);
                alert(p);

                window.location.href = "callback://openURL?" + p;
            });
        });

        function ok(rs) {
            alert(rs);
        }

        function alipayCallback() {
            alert("支付成功");
        }

        function sharedCallback() {
            alert("分享成功");
        }

        function pushCallBack(channelId, userId) {
            alert("channelId:" + channelId + "   userId:" + userId);
        }

        function locCallBack(jsonStr) {
            alert('ok')
            alert(jsonStr);
        }

        function oauthCallBack(jsonStr) {
            alert(jsonStr);
        }

        function wxPayCallBack() {
            alert("支付成功");
        }

        function copyCallBack() {
            alert("复制成功");
        }

        function openAppCallBack(rs) {
            alert("结果:" + rs);
        }
        
    </script>
</body>
</html>
